//
//  TZYHeaderView.m
//  Moment
//
//  Created by dllo on 15/12/30.
//  Copyright © 2015年 片刻. All rights reserved.
//

#import "TZYHeaderView.h"

@interface TZYHeaderView ()

@property (nonatomic, strong) UIView *headerView;

@end


@implementation TZYHeaderView


- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        
        [self createSubviews];
    }
    
    return self;
}
- (void)createSubviews
{
    
    NSMutableArray *arrT = [NSMutableArray arrayWithObjects:@"全部", @"文章", @"碎片", @"Ting", @"话题", nil];
    
    for (NSInteger i = 0; i < arrT.count; i++) {
        UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
        button.backgroundColor = [UIColor colorWithRed:arc4random() % 256 / 255.0 green:arc4random() % 256 / 255.0 blue:arc4random() % 256 / 255.0 alpha:1.0];
        [button setTitle:[arrT objectAtIndex:i] forState:UIControlStateNormal];
        button.frame = CGRectMake((i % 3) * (self.bounds.size.width / 3), (i / 3) * (self.bounds.size.height / 2), self.bounds.size.width / 3, self.bounds.size.height / 2);
        button.tag = 3000 + i;
        [button addTarget:self action:@selector(buttonAction:) forControlEvents:UIControlEventTouchUpInside];
        [self addSubview:button];
    }
    
    

}



- (void)buttonAction:(UIButton *)sender
{
    
}


/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
